package generators;

import gamebackend.Block;

/**
 * Creates blocks at the end of a path.
 * @author Jonathan Caddey
 *
 */
public class EndCapGenerator extends AbstractGenerator {

	public EndCapGenerator(Block the_block) {
		super(the_block);
	}

	@Override
	public void generate(Block[][] blocks) {
		// below is path, but left and right are both not path.
		for (int col = 0; col < blocks[1].length; col++) {
			if (!blocks[1][col].isOccupied() && !blocks[1][col].isPath() && blocks[0][col].isPath()
					//&& ((col == 0 || blocks[1][col - 1].isPath())
							//&& (col == blocks[1].length - 1 || blocks[1][col + 1].isPath()))
							) {
				blocks[1][col] = getBlock();
			}
		}
		
	}

}
